package cn.demographic.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.demographic.dao.ApplicanttableMapper;
import cn.demographic.dao.PregnancyMapper;
import cn.demographic.dao.UserMapper;
import cn.demographic.dao.RelationshipMapper;
import cn.demographic.dao.WorkingconditionsMapper;
import cn.demographic.entity.Pregnancy;
import cn.demographic.entity.User;
import cn.demographic.entity.Relationship;
import cn.demographic.entity.Workingconditions;
import cn.demographic.service.WorkingconditionsService;

/*
 *从业状况业务层
 * */
@Service
@Transactional
public class WorkingconditionsServiceImpl implements WorkingconditionsService {

	@Autowired
	private WorkingconditionsMapper workingconditionsMapper;
	@Autowired
	private PregnancyMapper pregnancyMapper;
	@Autowired
	private UserMapper userMapper;
	@Autowired
	private RelationshipMapper relationshipmapper;
	@Autowired
	private ApplicanttableMapper applicanttableMapper;

	
	/**
	 * 查询从业状况
	 */
	@Override
	public List<Workingconditions> selectWork() {
		return workingconditionsMapper.find();
	}

	/**
	 * 查询所有的怀孕避孕
	 */
	@Override
	public List<Pregnancy> selectPregnancy() {
		
		return pregnancyMapper.selectPregnancy();
	}

	/**
	 * 录用信息审核的数据
	 * @return
	 */
	public List<User> selectUser(Map<String,Object> map) {	
		return userMapper.selectUser(map);
	};

	/**
     * 查询家庭关系信息
     * @return
     */
	@Override
	public List<Relationship> findRelationship() {
		
		return relationshipmapper.findRelationship();
	}

	/**
	  * 查询录入信息审核状态的数量
	  * @param map
	  * @return
	  */
	@Override
	public Long countUser(Map<String, Object> map) {
		
		return userMapper.countUser(map);
	}

	/**
     * 修改审核数据
     * @param userid
     * @param status
     * @return
     */
	@Override
	public Integer updetApplicanttable(Integer[] userid, Integer status , String state) {
		
		return applicanttableMapper.updetApplicanttable(userid, status ,state);
	}

	/**
	 * 流动人口信息管理
	 * @return
	 */
	@Override
	public List<User> selectUserEmployment(Map<String,Object> map) {
		
		return userMapper.selectUserEmployment(map);
	}

	/**
	 * 流动人口信息管理分页
	 * @return
	 */
	@Override
	public Long countUserEmployment(Map<String, Object> map) {
		
		return userMapper.countUserEmployment(map);
	}

}
